home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_02 / portable / wmove.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-17  |  1.7 KB  |  65 lines

  1. #define    CURSES_LIBRARY    1
  2. #include <curses.h>
  3. #undef    wmove
  4.  
  5. #ifdef PDCDEBUG
  6. char *rcsid_wmove = "$Header: C:\CURSES\portable\RCS\wmove.c 2.1 1993/06/18 20:21:45 MH Rel MH $";
  7. #endif
  8.  
  9.  
  10.  
  11.  
  12. /*man-start*********************************************************************
  13.  
  14.   wmove()    - Move cursor in window
  15.  
  16.   X/Open Description:
  17.      The cursor associated with the window is moved to the given
  18.      location.  This does not move the physical cursor of the
  19.      terminal until refresh() is called.  The position specified is
  20.      relative to the upper left corner of the window, which is (0,0).
  21.  
  22.      NOTE: move() is a macro.
  23.  
  24.   PDCurses Description:
  25.      There may be additional [window oriented] move routines associated
  26.      with other sections of the curses library.  See those sections for
  27.      details.
  28.  
  29.   X/Open Return Value:
  30.      These functions return OK on success and ERR on error.
  31.  
  32.   PDCurses Errors:
  33.      It is an error to call this function with a NULL window pointer.
  34.  
  35.   Portability:
  36.      PDCurses    int wmove( WINDOW* win, int y, int x );
  37.      X/Open Dec '88    int wmove( WINDOW* win, int y, int x );
  38.      BSD Curses    int wmove( WINDOW* win, int y, int x );
  39.      SYS V Curses    int wmove( WINDOW* win, int y, int x );
  40.  
  41. **man-end**********************************************************************/
  42.  
  43. int    wmove(WINDOW *win, int y, int x)
  44. {
  45. #ifdef PDCDEBUG
  46.     if (trace_on) PDC_debug("wmove() - called: y=%d x=%d\n",y,x);
  47. #endif
  48.  
  49.     if (win == (WINDOW *)NULL)
  50.         return( ERR );
  51.  
  52.     if ((x < 0) ||
  53.         (y < 0) ||
  54.         (x >= win->_maxx) ||
  55.         (y >= win->_maxy) ||
  56.         (y < win->_tmarg) ||
  57.         (y > win->_bmarg))
  58.     {
  59.         return( ERR );
  60.     }
  61.     win->_curx = x;
  62.     win->_cury = y;
  63.     return( OK );
  64. }
  65.